import Cookies from 'js-cookie'
import {login} from "@/api/user";
import {setToken} from "@/utils/auth";
import {getRouters} from "@/api/operation";
import {error} from "autoprefixer/lib/utils";

const state = {
  operation:[],
}

const mutations = {
  SET_MENU:(state,operation)=>{
    state.operation=operation
  }
}

const actions = {
  getRouters({commit}){
    return new Promise((resolve,reject)=>{
      getRouters().then(response=>{
        const {data} = response
        commit('SET_MENU',data)
        resolve()
      }).catch(error=>{
        reject(error)
      })
    })
  },
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
